<template>
<div>
    <div style="background-color: white">
        <el-row>
            <el-col :span="7" :pull="0">
                <span style="color: #606266;font-size:25px;font-weight:bold" href="#">添加业主房产（共3步：1/3）</span>
            </el-col>
            <el-col :span="5" :offset="12">
                <el-button @click="last()" icon="el-icon-caret-left">上一步</el-button>
            </el-col>
        </el-row>
  <el-row>
      <el-col :span="5">
        <a style="color: #606266" href="#">首页</a>
        <a style="color: #dcdfe6" href="#">/ 资产管理 </a>
        <a style="color: #dcdfe6" href="#">/ 楼栋信息</a></el-col
      >
    </el-row>
    </div>
    <hr />
    <el-row style="background-color: white">
        <el-col :span="3"><a style="color: #606266;font-size:25px;">选择楼栋：</a></el-col>
    </el-row>

    <template>
      <el-table :data="pagination.records" style="width: 100%">
          <el-table-column prop="name" label="名称" width="260px">
        </el-table-column>
        <el-table-column prop="area" label="建筑面积" width="260px">
        </el-table-column>
        <el-table-column prop="buildingId" label="楼栋ID" width="260px">
        </el-table-column>
        <el-table-column prop="admin.username" label="创建员工" width="260px">
        </el-table-column>
        <el-table-column label="操作" align=center> 
            <template slot-scope="scope">
                <el-button size="medium" @click="xuanze(scope.row)" round>选择</el-button>
        </template>
        </el-table-column>
      </el-table>
      <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pagination.current"
      :page-sizes="[3, 5, 8, 10]"
      :page-size="pagination.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="pagination.total"
    >
    </el-pagination>
    </template>
</div>
</template>

<script>
export default {
    data(){
        return{
             pagination:[]
        };
    },
    methods:{  
last(){
    this.$router.push("/yezhu/yezhu");
},
find(page = 1, pageSize = 5){
        let url="/loudong/Info";
        console.log(page);
        let params={page:page,pageSize:pageSize,id:this.loudongid,lname:this.loudongname};
        console.log(params);
        this.$axios.post(url,params).then(resp=>{this.pagination = resp.data.result;console.log(this.pagination)});
      },
      handleSizeChange(pageSize) {
      this.find(this.pagination.current, pageSize);
    },
    //当前页面发生改变，查询
    handleCurrentChange(page) {
      this.find(page, this.pagination.size);
    },
    xuanze(row){
        console.log(row);
        this.$store.dispatch("changeName",row.name);
        this.$router.push('/yezhu/fangwu');
    }
},mounted(){
    this.find();
}
    }

</script>

<style>

</style>